import {
  defineStore
} from 'pinia'
export const searchStore = defineStore('search', {
  state: () => {
    return {
   searchlist:{
     list:[]
   } ,
    category : {
      list:[],
      fglist:[],
      pplist:[]
    },
   catelist:{
     list:[]
   }
    }
  },
  actions: {
    //获取分类信息
   async getcategory(){
        const response  = await uni.$http.get("/search/getcategory")
        this.category.list = response.data.gategory
         this.category.fglist  = response.data.stylecategory
         this.category.pplist = response.data.Company
    },
    //获取搜索列表
  async getsearchlist(data){
       const response  = await uni.$http.post("/search/searchlist",data)
       this.searchlist.list = response.data
   },
  //获取分类列表
  async getcatelist(id){
       const response  = await uni.$http.get("/cate/catelist",{"id":id})
       // console.log(response);
       this.catelist.list = response.data
   },
    }
})